//小蜜蜂类
public class Bee extends FlyingObject{
    int speed;
    boolean flag=true;

    Bee(){
        health=1;
        x= (int) (Math.random()*400);
        y=-imageHeight;

        image=ImageFiler.bee;
        imageWidth=image.getWidth();
        imageHeight=image.getHeight();

        speed=2;
    }

    @Override
    void move() {
        if(flag){
            x +=speed*2;
            y +=speed;
        }else {
            x -=speed*2;
            y +=speed;
        }
        if(x>400-imageWidth){
            x -=speed*2;
            flag=false;
        }else if(x<0){
            x +=speed*2;
            flag=true;

        }
    }

    public int getSpeed() {
        return speed;
    }

    public void setSpeed(int speed) {
        this.speed = speed;
    }

}
